<template>
          <div class="xxx" style="width:100%;" >    
          	<p @click="xzdz">{{dz}}</p>
          	  <div id="sjld" style="">
          	  	<h1 class="xz">
                   <span @click="qx" class="sss">取消</span>
                   <span @click="qd" class="sss">确定</span>
	              </h1> 
	             <div class="boxxx" style="width:100%;" >
	                <mt-picker class="ld" :slots="myAddressSlots" @change="onMyAddressChange"></mt-picker>
	             </div>
          	  </div>              
          </div>
</template>

<script>
	import $ from "jquery"
  import { Picker } from 'mint-ui';
 import myaddress from '../../static/address3.json' //引入省市区数据
 export default {
 name: '',
 components: {
  'mt-picker': Picker
 },
 props: {},
 data () {
  return {
  dz:"选择地址",	
  myAddressSlots: [
   {
   flex: 1,
   defaultIndex: 1, 
   values: Object.keys(myaddress), //省份数组
   className: 'slot1',
   textAlign: 'center'
   }, {
   divider: true,
   content: '-',
   className: 'slot2'
   }, {
   flex: 1,
   values: [],
   className: 'slot3',
   textAlign: 'center'
   },
   {
   divider: true,
   content: '-',
   className: 'slot4'
   },
   {
   flex: 1,
   values: [],
   className: 'slot5',
   textAlign: 'center'
   }
  ],
  myAddressProvince:'省',
  myAddressCity:'市',
  myAddresscounty:'区/县',
  }
 },
 created() {
 
 
 },
 methods: {
  onMyAddressChange(picker, values) {
  if(myaddress[values[0]]){ 
   picker.setSlotValues(1,Object.keys(myaddress[values[0]])); 
   picker.setSlotValues(2,myaddress[values[0]][values[1]]); 
   this.myAddressProvince = values[0];
   this.myAddressCity = values[1];
   this.myAddresscounty = values[2];
  }
  },
  qx(){
       this.$router.push({name:'linkman'})
  },
  qd(){
  	    
        $("#sjld").css("display","none")
        console.log(this.myAddressProvince,this.myAddressCity,this.myAddresscounty)
  },
  xzdz(){
  	   $("#sjld").css("display","block")
  }
 },
 mounted(){
  this.$nextTick(() => {
  this.myAddressSlots[0].defaultIndex = 0 
  });
 }
 }
</script>


<style lang="less" scoped>
       .xxx{
            position:fixed;
            bottom:6.9rem;
       }
       .ld{
           width:100%;
       }
       .xz{
            width:100%;
            height:1.5rem;
            display:flex;
            justify-content:space-between;
            background:#fff;
       }
       .sss{
            font-size:0.6rem;
            line-height:1.5rem;
            padding-left:10%;
            padding-right:10%;
            color:#2eb3e8;
       }
       .boxxx{
            position:fixed;
            bottom:0;
            height:6.9rem;
       }
</style>